import translate from './translate';


export default function customTranslate(template, replacements) {
    replacements = replacements || {};

    // Translate
    template = translate[template] || template;

    // Replace
    return template.replace(/{([^}]+)}/g, function(_, key) {

        let str = replacements[key];
        if(translate[replacements[key]]!=null&&translate[replacements[key]]!=='undefined'){
            str=translate[replacements[key]];
        }
        return  str || '{' + key + '}';

    });
}
